package com.woniu.liuzhougov.itemQueryAndNotice.service;

import com.woniu.liuzhougov.authorityControl.pojo.User;
import com.woniu.liuzhougov.itemAndTask.pojo.Department;
import com.woniu.liuzhougov.itemAndTask.pojo.Notice;
import com.woniu.liuzhougov.itemAndTask.pojo.UserNotice;
import com.woniu.liuzhougov.itemQueryAndNotice.mapper.NoticeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class NoticeService implements NoticeMapper{

    @Autowired
    private NoticeMapper noticeMapper;


    @Override
    public int addNotice(Notice notice,User user) {
        int addNotice = noticeMapper.addNotice(notice,user);
        return addNotice;
    }

    @Override
    public List<Notice> findAllNotice() {
        List<Notice> allNotice = noticeMapper.findAllNotice();
        return allNotice;
    }

    @Override
    public User findUserNameById(int notice_founder_id) {
        User findUserNameById = noticeMapper.findUserNameById(notice_founder_id);
        return findUserNameById;
    }

    @Override
    public int addPersonalNotice(UserNotice userNotice, Integer userId, Integer currentUserId) {
        int personalNotice = noticeMapper.addPersonalNotice(userNotice, userId, currentUserId);
        return personalNotice;
    }

    @Override
    public List<UserNotice> findPersonalNotice(Integer currentUserId) {
        List<UserNotice> personalNotice = noticeMapper.findPersonalNotice(currentUserId);
        return personalNotice;
    }

    @Override
    public User findFounderById(Integer user_nt_founder) {
        User founderById = noticeMapper.findFounderById(user_nt_founder);
        return founderById;
    }

    @Override
    public User findRecenderById(Integer user_nt_recender) {
        User recenderById = noticeMapper.findRecenderById(user_nt_recender);
        return recenderById;
    }

    @Override
    public Department findDepartmentById(Integer department_id) {
        Department departmentById = noticeMapper.findDepartmentById(department_id);
        return departmentById;
    }
}
